#!/bin/sh
#
# brltty        Starts brltty.
#

start() {
	printf "Starting brltty: "
	start-stop-daemon -S -q -p /var/run/brltty.pid \
		--exec /usr/bin/brltty -- -P /var/run/brltty.pid "$@"
	[ $? = 0 ] && echo "OK" || echo "FAIL"
}
stop() {
	printf "Stopping brltty: "
	start-stop-daemon -K -q -p /var/run/brltty.pid
	[ $? = 0 ] && echo "OK" || echo "FAIL"
}
restart() {
	stop
	start "$@"
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	restart
	;;
  force-reload)
	restart
	;;
  *)
	echo "Usage: $0 {start|stop|restart|force-reload}"
	exit 1
esac

exit $?
